package util;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;

import beans.factory.BeanFactory;

public class DBFactory {
	private static Connection connection;
	static{
		try {
			connection =((DataSource)BeanFactory.getInstance().getBean("dataSource")).getConnection();
		} catch (BeansException | SQLException e) {
			e.printStackTrace();
			connection = null;
		}
	}
	
	public static Connection getInstance(){
		return connection;
	}
}
